cmake_minimum_required(VERSION 3.0)
project(Example)
find_package(Java REQUIRED)
include(UseJava)
add_jar(${PROJECT_NAME} Example.java com/dji/wpmz/WpmzJni.java)
enable_testing()
get_target_property(_jarFile ${PROJECT_NAME} JAR_FILE)
get_target_property(_classDir ${PROJECT_NAME} CLASSDIR)
message(STATUS "Jar file ${_jarFile}")
message(STATUS "Class compiled to ${_classDir}")
add_test(NAME Test${PROJECT_NAME} COMMAND ${Java_JAVA_EXECUTABLE} -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/.. -cp ${_jarFile} ${PROJECT_NAME})